home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / pgm_util / sealit / wizard / foo / info.bas < prev    next >
Encoding:
BASIC Source File  |  1996-01-06  |  2.0 KB  |  66 lines

  1. Option Explicit
  2.  
  3. Function CreateExpireTime ()
  4.     Dim wMonth%, wDay%, wYear%, tmExpired#, tmCurrent#
  5.     
  6.     tmExpired# = Now + 5
  7.     wMonth% = Month(tmExpired#)
  8.     wDay% = Day(tmExpired#)
  9.     wYear% = Right(Year(tmExpired#), 2)
  10.     CreateExpireTime = ConvertDateToLong(wMonth%, wDay%, wYear%)
  11.  
  12. End Function
  13.  
  14. Sub SaveInfo ()
  15.     Dim lConvertedTime&, wBufferLen%
  16.     
  17.     gApplicationInfo.bOverWriteSeal = True  'reinit this field to true so
  18.                                             'we can over-write the butter
  19.     'save the size of the foo type
  20.     wBufferLen% = Len(gfoo)
  21.  
  22.     
  23.     ' initialize the buffer with the buffer len
  24.     If InitializeBuffer(wBufferLen%) <> 0 Then
  25.         MsgBox "Couldn't allocate memory for buffer. Please restart Windows and try again. If the problem presists, please contract Ralph Krausse at Kustom Magic Software, E-MAIL: ralphk@primenet.com.", MB_ICONSTOP, "Verication"
  26.     End If
  27.  
  28.     SaveInt False  'foo.bFirstTime
  29.     
  30.     lConvertedTime& = CreateExpireTime()
  31.     SaveLong lConvertedTime& 'foo.tmExpires
  32.     
  33.     SaveString CStr(frmRegister!txtCompany.Text) & Chr$(0), 60 'foo.szCompany
  34.     SaveString CStr(frmRegister!txtName.Text) & Chr$(0), 40 'foo.szLastName
  35.     SaveString "magicstring" & Chr$(0), 20 'foo.szMagicString
  36.                    
  37.     ' with the new seal in memory, write it out.
  38.     Dim wSealErr%
  39.     
  40.     wSealErr% = SealApplication(gApplicationInfo, wBufferLen%)
  41.     If wSealErr% <> 0 Then
  42.         MsgBox "Error " & wSealErr% & " during verification. ", MB_ICONSTOP, "Verication"
  43.         End
  44.     Else
  45.         MsgBox "foo is successfully self-registered. Please re-run foo.", MB_ICONSTOP, "Verication"
  46.         End
  47.     End If
  48.     DeInitializeBuffer
  49.  
  50.  
  51. End Sub
  52.  
  53. Function strip_nulls (szString$)
  54.     Dim wLen%
  55.     wLen% = InStr(szString$, Chr$(0))
  56.     If wLen% = 0 Then
  57.         strip_nulls = szString$
  58.     Else
  59.         strip_nulls = Left(szString$, wLen% - 1)
  60.     End If
  61.         
  62.  
  63.  
  64. End Function
  65.  
  66.